<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:font-size="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>打印合格证</title>
    <meta name="keywords" content="打印合格证">
    <meta name="description" content="打印合格证">

    <script language="javascript" src="jquery-2.0.3.min.js.js"></script>
    <script language="javascript" src="WarnPrint.js"></script>
    <script language="javascript" src="template.js"></script>
</head>
<body onload="load()">
<input type="button" value="打印" onclick="showjson()" style="width:20%;height:auto"><br><br></font></p>
<script language="javascript" type="text/javascript">
    //var LODOP; //声明为全局变量
    function load() {
//        InitialPage();
    }
    var data;
    function showjson() {
        //如需传参
        var jsn = window.MyBrowserAPI.getLocationData();
         data = JSON.parse(jsn);
        var argObj = {};
        loadJs(data.hostUrl, callMyFun, argObj);
    }

    function loadJs(loadUrl, callMyFun, argObj) {
        var loadScript = document.createElement('script');
        loadScript.setAttribute("type", "text/javascript");
        loadScript.setAttribute('src', loadUrl);
        console.log(loadUrl)
        document.getElementsByTagName("head")[0].appendChild(loadScript);
        //判断服务器
        if (navigator.userAgent.indexOf("IE") >= 0) {
            //IE下的事件
            loadScript.onreadystatechange = function () {
                if (loadScript.readyState == "loaded" || loadScript.readyState == "complete") {
                    //表示加载成功
                    loadScript.onreadystatechange = null;
                    debugger;
                    callMyFun()//执行回调
                }
            }
        }
        else {
            debugger;
            loadScript.onload = function () {
                loadScript.onload = null;
                debugger;
                callMyFun();
            }
        }
        console.log(argObj);
    }

    function callMyFun() {

//        var date = (new Date()).toLocaleDateString() + " " + (new Date()).toLocaleTimeString();
//        var json = {
//            "title": "护理佳纸业产品合格证",
//            "cpdm": "03.17.269",
//            "cpmc": "外卖原纸-无芯",
//            "ggxh": "15.5*466*3",
//            "jietou": "0",
//            "zj": "1100",
//            "bz": "乙班",
//            "jt": "三号分切机",
//            "date": date,
//            "amount": "82.00",
//            "username": "张三",
//            "opendirection": "http://192.168.1.229:8000/images/arrow_left.png",
//            "address": "河南省鹿邑县产业集聚区",
//            "tax": "0394-7490258",
//            "phone": "0394-7490998",
//            "web": "WWW.hulijia.com",
//            "qrcode": "1234567890版本7的最大值是122个字符123123",
//            "code": "YZ99952017072818"
//        };
        setTimeout(function () {
            WarnPrint(data)
        }, 200);
    }
</script>

</body>
</html>